class Custom_Pawn extends UTPawn;

var float CamOffsetDistance; //distance to offset the camera from the player in unreal units
var float CamZ; //how high cam is relative to pawn pelvis

// Stop aim node from aiming up or down
simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
	super.PostInitAnimTree(SkelComp);
	AimNode.bForceAimDir = false; //Forces center
}

simulated function PostBeginPlay()
{
	super.PostBeginPlay();
}

simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info)
{
}


// Only update pawn rotation while moving

simulated function FaceRotation(rotator NewRotation, float DeltaTime)
{

	// Do not update Pawn's rotation if not firing and no acceleration
	if (Normal(Acceleration) == vect(0,0,0))
		return;

	// Set ladder rotation
	if ( Physics == PHYS_Ladder )
		NewRotation = OnLadder.Walldir;
	else if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) ) // Don't use pitch when walking or falling
		NewRotation.Pitch = 0;

	// Set the new rotation
	SetRotation(NewRotation);
}

simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
	local vector start, end, hl, hn;
	local actor a;
	
	start = Location;
	
	if (Controller != none)
	{
		end = Location - Vector(Controller.Rotation) * 192.f;
	}
	else
	{
		end = Location - Vector(Rotation) * 192.f;
	}
	
	a = Trace(hl, hn, end, start, false);
	
	if (a != none)
	{
		out_CamLoc = hl;
	}
	else
	{
		out_CamLoc = end;
	}
	
	out_CamRot = Rotator(Location - out_CamLoc);
	return true;
}

exec function SetSpeed( int speed )
{
	GroundSpeed = speed;
}


// Do not play teleport effect
function PlayTeleportEffect(bool bOut, bool bSound);

DefaultProperties
{
	CamZ = 100.0
   	CamOffsetDistance=175.0

	ViewPitchMin=-8192 // ~45 deg
	//ViewPitchMax=2730 // ~15 deg
	ViewPitchMax=500 // ~15 deg

	GroundSpeed=220
	Begin Object Name=WPawnSkeletalMeshComponent
		SkeletalMesh=SkeletalMesh'UDKSwordStudy.BasicCharacter'
		AnimSets(0)=AnimSet'UDKSwordStudy.BasicCharacter_AnimSet'
		bCacheAnimSequenceNodes=FALSE
		AlwaysLoadOnClient=true
		AlwaysLoadOnServer=true
		bOwnerNoSee=false
		CastShadow=true
		BlockRigidBody=TRUE
		bUpdateSkelWhenNotRendered=false
		bIgnoreControllersWhenNotRendered=TRUE
		bUpdateKinematicBonesFromAnimation=true
		bCastDynamicShadow=true
		RBChannel=RBCC_Untitled3
		RBCollideWithChannels=(Untitled3=true)
		LightEnvironment=MyLightEnvironment
		bOverrideAttachmentOwnerVisibility=true
		bAcceptsDynamicDecals=FALSE
		AnimTreeTemplate=AnimTree'UDKSwordStudy.BasicCharacterAnimTree'
		//PhysicsAsset=PhysicsAsset'UDKSwordStudy.BasicCharacter_Physics'
		bHasPhysicsAssetInstance=true
		TickGroup=TG_PreAsyncWork
		MinDistFactorForKinematicUpdate=0.2
		bChartDistanceFactor=true
		//bSkipAllUpdateWhenPhysicsAsleep=TRUE
		RBDominanceGroup=20
		Scale=1
		//MotionBlurScale=0.0
		bAllowAmbientOcclusion=false
	End Object
	Mesh=WPawnSkeletalMeshComponent
	Components.Add(WPawnSkeletalMeshComponent)
	
	
		Begin Object Name=CollisionCylinder
		CollisionRadius=+0021.000000
		CollisionHeight=+0024.000000
	End Object
}
